class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0;
        int right = height.size() - 1;
        int m = INT_MIN;
        while (left < right)
        {
            int a = min(height[left], height[right]);
            m = max(a * (right - left), m);
            if (height[left] < height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        return m;
    }
};